package com.hotel.main.entity;

import java.util.Date;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import com.hotel.main.entity.enums.FoodPlace;
import com.hotel.main.entity.enums.FoodPlan;

@Entity
@Table(name = "client_card")
@SequenceGenerator(name="client_card_gen", allocationSize=1, sequenceName="client_card_seq")
public class ClientCard extends AbstractEntity {
	private static final long serialVersionUID = 1L;
	
	@Id
	@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="client_card_gen")
	private Long id;
	
	@OneToOne(cascade=CascadeType.ALL, fetch=FetchType.EAGER)
    @JoinColumn(name="client_id")
	private Client client;
	
	@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.EAGER, mappedBy="clientCard")
	private List<Room> room;
	
	@Column(name = "entry_date")
	@Temporal(TemporalType.DATE)
	private Date entryDate;
	
	@Column(name = "leave_date")
	@Temporal(TemporalType.DATE)
	private Date leaveDate;
	
	@Column(name = "adults_quantity")
	private Byte adultsQuantity;
	
	@Column(name = "children_quantity")
	private Byte childrenQuantity;
	
	@Column(name = "food_plan")
	@Enumerated(EnumType.STRING)
	private FoodPlan foodPlan;
	
	@Column(name = "food_place")
	@Enumerated(EnumType.STRING)
	private FoodPlace foodPlace;

    @Override
	public void setId(Long id) {
		this.id = id;
	}

    @Override
	public Long getId() {
		return id;
	}

	public void setClient(Client client) {
		this.client = client;
	}

	public Client getClient() {
		return client;
	}

	public void setRoom(List<Room> room) {
		this.room = room;
	}

	public List<Room> getRoom() {
		return room;
	}

	public void setEntryDate(Date entryDate) {
		this.entryDate = entryDate;
	}

	public Date getEntryDate() {
		return entryDate;
	}

	public void setLeaveDate(Date leaveDate) {
		this.leaveDate = leaveDate;
	}

	public Date getLeaveDate() {
		return leaveDate;
	}

	public void setAdultsQuantity(Byte adultsQuantity) {
		this.adultsQuantity = adultsQuantity;
	}

	public Byte getAdultsQuantity() {
		return adultsQuantity;
	}

	public void setChildrenQuantity(Byte childrenQuantity) {
		this.childrenQuantity = childrenQuantity;
	}

	public Byte getChildrenQuantity() {
		return childrenQuantity;
	}

	public void setFoodPlan(FoodPlan foodPlan) {
		this.foodPlan = foodPlan;
	}

	public FoodPlan getFoodPlan() {
		return foodPlan;
	}

	public void setFoodPlace(FoodPlace foodPlace) {
		this.foodPlace = foodPlace;
	}

	public FoodPlace getFoodPlace() {
		return foodPlace;
	}
}
